package br.com.marsso.sorte.client;

import java.util.logging.Level;
import java.util.logging.Logger;

import br.com.marsso.sorte.client.ui.Menu;
import br.com.marsso.sorte.shared.SorteRequestFactory;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Sorte implements EntryPoint {
	private static final Logger log = Logger.getLogger(Sorte.class.getName());

	EventBus eventBus = new SimpleEventBus();

	@Override
	public void onModuleLoad() {
		
		GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
		      public void onUncaughtException(Throwable e) {
		        log.log(Level.SEVERE, e.getMessage(), e);
		      }
		    });

		final SorteRequestFactory requests = GWT
				.create(SorteRequestFactory.class);

		requests.initialize(eventBus);

		RootPanel.get("menu").add(new Menu(requests));

	}

}
